<?php

function generateRandomArray( $min, $max, $size ){
	$array = array();
	for( $index=0; $index<$size; $index++ ){
		$array[] = rand( $min, $max );
	}

	return $array;
}

function swap( &$arr, $pos1, $pos2 ){
	$temp = $arr[ $pos1 ];
	$arr[ $pos1 ] = $arr[ $pos2 ];
	$arr[ $pos2 ] = $temp;
}

// Recursive function that does quick sort
function quick_sort( &$arr ){
	$length = count( $arr );
	if( 1 >= $length ){
		// Nothing to do
		return;
	}

	$smaller = array();
	$larger = array();
	$pivot = $arr[ 0 ];

	// Start splitting the rest into two groups, larger and smaller
	for( $index=1; $index<$length; $index++ ){
		if( $arr[$index] < $pivot ){
			$smaller[] = $arr[$index];
		}
		else {
			$larger[] = $arr[$index];
		}
	}

	quick_sort( $smaller );
	quick_sort( $larger );

	$arr = array_merge( $smaller, array($pivot), $larger );
}

function importJS(){

// Import libraries
echo <<< EOD
<script type='text/javascript' src='js/jquery-1.7.1.min.js'></script>
<script type='text/javascript' src='js/wz_jsgraphics.js'></script>
EOD;

}


// Data structures
require_once 'bst.php';
require_once 'll.php';

?>